package com.tmxk.springmvc.controller;

import com.tmxk.springmvc.pojo.UserInfo;
import com.tmxk.springmvc.pojo.Users;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/layUi")
public class LayUiController {
    @RequestMapping("/last.do")
    public String layUiLast(){
        return "/static/layui_test.html";
    }

    @ResponseBody
    @RequestMapping(value = "/edit.do",method = RequestMethod.POST)
    public String editData(Users users){
        System.out.println(users);
        return "";
    }

    @RequestMapping("/formData.do")
    public String formData(){
        return "redirect:/static/layui_from_test.html";
    }

    @RequestMapping(value = "/getFrom.do",method = RequestMethod.POST)
    public String getFrom(UserInfo userInfo){
        System.out.println(userInfo);
        //调用service保存数据的方法,将数据添加到数据库中

        return "redirect:/static/layui_from_test.html";
    }
}
